package com.yc.sole.erp.request;

import com.yc.sole.erp.enums.ShipmentType;
import com.yc.sole.framework.validate.SaveGroup;
import com.yc.sole.framework.validate.UpdateGroup;
import jakarta.validation.Valid;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * Request对象
 *
 * @author yizuomin
 * @date 2024-01-16
 **/
@Data
public class ShipmentReq implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @NotNull(groups = {UpdateGroup.class})
    private Long id;
    /**
     * 送货日期
     */
    @Length(max = 10, groups = {SaveGroup.class, UpdateGroup.class})
    @NotBlank(groups = {SaveGroup.class, UpdateGroup.class})
    private String shipmentDate;
    /**
     * 送货类型
     */
    @NotNull(groups = {SaveGroup.class, UpdateGroup.class})
    private ShipmentType shipmentType;
    /**
     * 承运商/物流公司
     */
    @Length(max = 50, groups = {SaveGroup.class, UpdateGroup.class})
    private String carrier;
    /**
     * 物流单号
     */
    @Length(max = 32, groups = {SaveGroup.class, UpdateGroup.class})
    private String trackingNo;
    /**
     * 运费
     */
    @DecimalMin(value = "0.01", groups = {SaveGroup.class, UpdateGroup.class})
    private BigDecimal shipCost;
    /**
     * 收件人名称
     */
    @Length(max = 50, groups = {SaveGroup.class, UpdateGroup.class})
    private String recipientName;
    /**
     * 收件人手机号
     */
    @Length(max = 20, groups = {SaveGroup.class, UpdateGroup.class})
    private String recipientPhoneNum;
    /**
     * 送货地址
     */
    @Length(max = 255, groups = {SaveGroup.class, UpdateGroup.class})
    private String recipientAddress;
    /**
     * 备注
     */
    @Length(max = 255, groups = {SaveGroup.class, UpdateGroup.class})
    private String remark;
    /**
     * 订单信息
     */
    @Valid
    @NotEmpty(groups = {SaveGroup.class, UpdateGroup.class})
    private List<ShipmentOrderReq> orderList;
}
